/**
 * 
 */
package com.oauth.components.client.ui.gadgets;

import com.google.gwt.user.client.ui.Image;
import com.oauth.components.client.ui.CommonResources;

/**
 * @author asanthan
 * 
 */
public class ImageUI extends Image {

	public void setUrl(String url) {
		if (isEmpty(url)) {
			super.setResource(CommonResources.INSTANCE.nophoto());
		} else {
			super.setUrl(url);
		}
	}

	/**
	 * @param url
	 * @return
	 */
	private boolean isEmpty(String url) {
		return url == null || url.trim().length() == 0;
	}

}
